package org.example;

import java.io.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class IO_Demo24 {
    public static void main(String[] args) throws IOException {
        //写入数据
        Properties p = new Properties();
        p.put("aaa","111");
        p.put("bbb","222");
        p.put("ccc","333");
        FileOutputStream fos = new FileOutputStream("D:\\Idea_xiangmu\\IdeaProjects\\Two_test\\a.properties");
        // 注释 将数据按键值对对象写入文件中
        p.store(fos,"test");
        fos.close();

        /*BufferedWriter bos = new BufferedWriter("D:\\Idea_xiangmu\\IdeaProjects\\Two_test\\a.properties");
        Set<Map.Entry<Object, Object>> set = p.entrySet();
        for (Map.Entry<Object, Object> entry : set) {
            Object key=entry.getKey();
            Object value=entry.getValue();
            bos.write(key+"="+value);
            bos.newLine();
        }
        bos.close();*/



    }
}
